package com.common.retrofit.method;

import com.common.Entity.HomeEntity;
import com.common.cons.Constans;
import com.common.retrofit.base.BaseMethods;
import com.common.retrofit.service.DuoBaoService;
import com.common.utils.SortUtils;

import rx.Observable;
import rx.Subscriber;

public class HomeDuobaoMethods extends BaseMethods {

    private static HomeDuobaoMethods m_ins = null;

    public static HomeDuobaoMethods getInstance() {
        if (m_ins == null) {
            synchronized (HomeDuobaoMethods.class) {
                if (m_ins == null) {
                    m_ins = new HomeDuobaoMethods();
                }
            }
        }
        return m_ins;
    }

    @Override
    protected String getHttpUrl() {
        return "Api/Goods/";
    }

    private DuoBaoService initService() {
        return getRetrofit().create(DuoBaoService.class);
    }


    public void     appIndexList   (Subscriber<HomeEntity> subscriber,
                      int uid ,
                      String hashid ,int  page
                                    ,int sorttype
                                    ,int rule
    ) {
        String time  = System.currentTimeMillis()+"" ;
        Observable observable = initService().appIndexList(time,
                SortUtils.getMyHash("uid"+uid,"hashid"+hashid ,"time"+time,"page"+page,"rule"+rule,"sorttype"+sorttype), Constans.ANDROID_APP_ID,"3",
                uid,hashid ,page ,sorttype,rule
        );
        toSubscribe(observable, subscriber);
    }
}
